package com.cn.wanxi.dto;

import java.util.List;

public class ResultModel<T> {
    private String code;
    private String result;
    private List<T> list;//泛型
    public static final String ERRORCODE = "200";
    public static final String SUCCESSCODE = "400";
    private static final String SUCCESSRESULT = "查询成功";

    public ResultModel() {
    }

    public ResultModel(List<T> list) {
        this.code = ERRORCODE;
        this.result = SUCCESSRESULT;
        this.list = list;
    }

    public ResultModel(String code, String result, List<T> list) {
        this.code = code;
        this.result = result;
        this.list = list;
    }

    public static ResultModel ResultError() {
        return new ResultModel("200", "请重新登录");
    }


    /**
     * 返回结果
     *
     * @param code
     * @param result
     */
    public ResultModel(String code, String result) {
        this.code = code;
        this.result = result;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
